package com.microservice.salmon.db.enums;

import lombok.Getter;

/**
 * 支付类型
 * 0:货到付款 1:在线支付
 */
@Getter
public enum PaymentTypeEnum {

    CASH_ON_DELIVERY("0","货到付款"),
    CASH_ONLINE("1","在线支付");

    private Byte code;
    private String message;
    PaymentTypeEnum(String code, String message) {
        this.code = Byte.valueOf(code);
        this.message = message;
    }

    public static PaymentTypeEnum codeOf(Byte code){
        for(PaymentTypeEnum v : values()){
            if(v.getCode().equals(code)){
                return v;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }
}